<%--
 *  File:    AdvancedConditionDetailEdit.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  Category cat = Category.getInstance("jsp.AdvancedConditionDetailEdit");
  String strModuleName = "PCM";
  String privilegeCode = "Z0610,L205";
%>



<%
  HashMap userInfo = (HashMap)session.getAttribute("userinfo");
 

%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="advancedconditionedit"/>
<%@ include file="/inc/InitEdit.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script>
function page_done()
{
  if(!checkpass(condetailaddform))
    return;
	document.condetailaddform.actionname.value = "done";
	document.condetailaddform.submit();
}
function checkpass(myform)
{
  if(isEmpty(myform.sortno.value))
  {
    alert('<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Sequence",false)) %>');
    return false;
  }
  if(!isNumber(myform.sortno.value))
  {
    alert('<%=message.getMessageDesc("VALUE_MUST_BE_NUMBER",label.getLabelName("L_Sequence",false)) %>');
    return false;
  }
  if(isEmpty(myform.script.value))
  {
    alert('<%=message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Value",false))%>');
    return false;
  }
  
  return true;
}
function page_view()
{
  var strURL="ViewTableStructure.jsp?conditionid=<custom:write  property="conditionid"/>";
  var strStatus="height=500, width=400, top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
  //if(popwindow!=null)
  //  popwindow.close();
  popwindow=window.open(strURL,"ViewTableStructure",strStatus);
}
</script>
</head>

<body>

<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" class="summary_top"></td>
  </tr>
  <tr>
    <td colspan="2"><img src="../../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
     <%= label.getLabelName("L_AddCondition") %><%= label.getLabelName("L_Colon") %></td>
  </tr>
</table>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <form name="condetailaddform" method="post" action="../../Dispatcher" target="_parent">
			   <input type="hidden" name="pagename" value="advancedconditionedit">
			   <input type="hidden" name="actionname">
				 <custom:hidden property="conditionid"/>
         <custom:hidden name="advancedconditioninfo" property="advancedconditionid"/>

  <tr>
    <td>
      <table width="100%" border="1" cellpadding="1" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr>
          <td class="need" width="74"><%= label.getLabelName("L_Sequence") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <custom:text name="advancedconditioninfo" property="sortno" size="15"/>
          </td>
        </tr>
       
        <tr>
          <td class="need"><%= label.getLabelName("L_Operator") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <%
            HashMap infoMap=(HashMap)pageContext.getAttribute("advancedconditioninfo");
            String strAndSelected="selected";
            String strAndExistsSelected="";
            String strAndNotExistsSelected="";
            if(infoMap!=null )
            {
              String strOper=(String)infoMap.get("operator");
              if(strOper!=null && strOper.equals("AND EXISTS"))
              {
                strAndSelected=""; 
                strAndExistsSelected="selected";   
                strAndNotExistsSelected="";

              } 
              else if(strOper!=null && strOper.equals("AND NOT EXISTS"))
              {
                strAndSelected=""; 
                strAndExistsSelected="";   
                strAndNotExistsSelected="selected";

              } 
            }   
            %>
            <select name="operator">
              <option value="AND"  <%=strAndSelected%> >AND</option>
              <option value="AND EXISTS"   <%=strAndExistsSelected%> >AND EXISTS</option>
              <option value="AND NOT EXISTS"   <%=strAndNotExistsSelected%> >AND NOT EXISTS</option>
              
            </select>
          </td>
        </tr>
        <tr>
          <td class="need"><%= label.getLabelName("L_SQL") %><%= label.getLabelName("L_Colon") %></td>
          <td>
           
              <custom:textarea  name="advancedconditioninfo" property="script" cols="60" rows="5"/>
          </td>
        </tr>
        <tr>
          <td class="td-text"><%= label.getLabelName("L_Comment") %><%= label.getLabelName("L_Colon") %></td>
          <td>
            <custom:text  name="advancedconditioninfo" property="memo" size="70"/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr>
    <td class="td_center">
      <a onclick="page_done()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
      <a onclick="page_view()"><custom:button type="1" label="L_ViewTableStructure" imgsrc="view.gif" border="0" style="width:60"/></a>
    </td>  
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
 </form>
</table>
</body>
</html>


